<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link href="${pageContext.request.contextPath}/themes/bootstrap/easyui.css" rel="stylesheet">
<link href="${pageContext.request.contextPath}/themes/icon.css" rel="stylesheet">
<script type="text/javascript" src="${pageContext.request.contextPath}/js/jquery-1.9.1.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/js/jquery.easyui.min.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/js/easyui-lang-zh_CN.js"></script>
<script	src="${pageContext.request.contextPath}/js/jquery.backstretch.js"></script>
<link href="${pageContext.request.contextPath}/css/bootstrap.min.css" rel="stylesheet">
<script	src="${pageContext.request.contextPath}/js/jquery.backstretch.js"></script>
<title>Insert title here</title>
</head>
<script type="text/javascript">
//配置添加提交事件
function addText() {
	$("#addDept").form('submit');
	
}
//配置清空事件
function clearText() {
	$("#addDept").form('clear');
}
function addForm() {
	$('#adDepts').dialog('open');
}


//配置日期文本框
        function myformatter(date){
            var y = date.getFullYear();
            var m = date.getMonth()+1;
            var d = date.getDate();
            return y+'-'+(m<10?('0'+m):m)+'-'+(d<10?('0'+d):d);
        }
        function myparser(s){
            if (!s) return new Date();
            var ss = (s.split('-'));
            var y = parseInt(ss[0],10);
            var m = parseInt(ss[1],10);
            var d = parseInt(ss[2],10);
            if (!isNaN(y) && !isNaN(m) && !isNaN(d)){
                return new Date(y,m-1,d);
            } else {
                return new Date();
            }
        }
        
        
        
$(function(){
	//默认添加表单是关闭的
	$('#adDepts').dialog('close');
 
	  //配置日期框不输入文字
	$('#dd').datebox({    
	    required:true ,
	    editable:false
	}); 
	
	
	//配置添加表单
	$("#addDept").form({
		url:'${pageContext.request.contextPath}/addDept',
		success:function(data){
			if(data=="1"){
				$('#adDepts').dialog('close');
				$("#adDepts").form('clear');
				$.messager.alert('我的消息','添加成功！！')
			 }else if(data=="0"){
				 $('#adDepts').dialog('close');
				 $("#adDepts").form('clear');
				 $.messager.alert('我的消息','部门已存在！！')
			}
		}
	});
	s
});
 
    
</script>
<body>
     
    <div class="container">
     <div id = "adDepts" class="easyui-dialog" title="添加部门信息"
     style="background:#ccc; width:100%;max-width:400px;display:none;padding:30px 60px;">     
     <form id = addDept method="post">    
        <center style="margin-bottom:20px">
                     部门名字:                 
            <input class="easyui-textbox"  data-options="required: true,missingMessage:'部门名必填'" name = "dept_name" style="width:50%;height:32px">
        </center>
        <center style="margin-bottom:20px">
                     部门描述:
            <input class="easyui-textbox" name = "dept_describe" style="width:50%;height:32px">
        </center>
        <center style="margin-bottom:20px">
                   创建时间:
            <input class="easyui-datebox" name = "dept_createtime" id ="dd" style="width:50%;height:32px">
        </center>
       
        </form>  
        
       	<div style="text-align: center; padding: 5px 0">
			<a href="javascript:void(0)" class="easyui-linkbutton"
				onclick="addText()" style="width: 80px">提交</a> 

			<a href="javascript:void(0)" class="easyui-linkbutton"
				onclick="clearText()" style="width: 80px">清空</a> 
		</div></div>
		<center>
	     <h1 align="center"style="color:blue;margin-top:100px">xxx公司部门管理</h1>
          <div style="width:50%;margin-top:100px">
		    <button type="button" onclick="addForm()" class="btn btn-primary btn-lg btn-block">添加部门</button>
		</div>
		</center>
		</div>		

</body>
</html>